<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>随手快递</title>
    <link rel="stylesheet" type="text/css" href="../../AUI/css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../font-awesome/css/font-awesome.min.css" />
    <link rel="stylesheet" href="http://cache.amap.com/lbs/static/main1119.css"/>
    <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.3&key=a37424dd342449fb8ab5f809081e01ce&plugin=AMap.CitySearch"></script>
    <script type="text/javascript" src="http://cache.amap.com/lbs/static/addToolbar.js"></script>
<style>
    .z_mask {
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, .5);
        position: fixed;
        top: 0;
        left: 0;
        z-index: 999;
        display: none;
    }

    .z_alert {
        width:75%;
        height: 130px;
        border-radius: .2rem;
        background: rgba(249, 249, 249, 0.98);
        font-size:15px;
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
    }
</style>
</head>
<body style="overflow-x: hidden">
<!--遮罩层-->
<div class="mask" id="login">
    <div class="alert">
        <p id="words">请先登录</p>
    </div>
</div>
<div class="mask" id="left"></div>
<div id="banner"></div>
<header class="aui-bar aui-bar-nav" id="header"></header>
<section class="aui-content-padded">
    <div class="aui-card-list">
        <div class="aui-card-list-header">

        </div>
        <div class="aui-card-list-content-padded" style="height: 80px">
            <label id="name"></label>，你好<br/>
            <div class="aui-btn aui-btn-warning aui-pull-right" id="pubOrder"><span class="aui-iconfont aui-icon-edit"></span>发布购买请求</div>
        </div>
    </div>
</section>
<div class="aui-card-list">
    <div class="aui-card-list-header" >
        <div><span style="color:#666666"> 猜您想买</span></div>
    </div>
    <div class="aui-card-list-content">
        <ul class="aui-list aui-media-list" id="wantBuy">
            <li class="aui-list-item aui-list-item-middle">
                <div class="aui-media-list-item-inner">
                    <div class="aui-list-item-media" style="width: 3rem;">
                        <img src="../../myImage/2.jpg" class="aui-img-round">
                    </div>
                    <div class="aui-list-item-inner">
                        <div class="aui-list-item-text">
                            <div class="aui-list-item-title aui-font-size-14">清风纸巾</div>
                            <div class="aui-list-item-right">买过4次</div>
                        </div>
                        <div class="aui-list-item-text">
                            <div class="aui-list-item-title aui-font-size-14"></div>
                            <div class="aui-list-item-right">物美超市</div>
                        </div>
                    </div>
                </div>
            </li>

        </ul>
    </div>
    <div class="aui-card-list-footer aui-text-center" style="margin-bottom: 90px">
        查看更多
    </div>
</div>


<footer class="aui-bar aui-bar-tab" id="footer"></footer>
<div id="container" style="display: none"></div>
<script type="text/javascript">
    var map = new AMap.Map("container", {
        resizeEnable: true,
        zoom: 11
    });
    //获取用户所在城市信息
    function showCityInfo() {
        //实例化城市查询类
        var citysearch = new AMap.CitySearch();
        //自动获取用户IP，返回当前城市
        citysearch.getLocalCity(function(status, result) {
            if (status === 'complete' && result.info === 'OK') {
                if (result && result.city && result.bounds) {
                    var cityinfo = result.city;
                    var citybounds = result.bounds;
                    document.getElementById('city').innerHTML =cityinfo;
                    //地图显示当前城市
                    map.setBounds(citybounds);
                }
            } else {
                document.getElementById('city').innerHTML = result.info;
            }
        });
    }
</script>
<script type="text/javascript" src="../../AUI/script/api.js" ></script>
<script src="../../myJs/jquery.js"></script>
<script src="../../myJs/jquery.cookie.js"></script>
<script type="text/javascript" src="../../myJs/iscroll.js" ></script>
<script type="text/javascript" src="../../AUI/script/aui-pull-refresh.js"></script>
<script type="text/javascript" src="../../myJs/index.js" ></script>
<script type="text/javascript">

    var userId,userState;
    $(function(){

        index();
        showCityInfo();
        $("#item2").addClass("aui-active");
        var permissions = sessionStorage.getItem("permissions");
        if(permissions==0){
            $("#tobe").hide();
        }else{
            $("#courier").hide();
        }
        var nickname=sessionStorage.getItem("nickname");
        $("#nickname").html(nickname);
        $("#name").html(nickname);
        var headPortraitUrl = sessionStorage.getItem("headPortraitUrl");
       $("#head-img").attr("src",headPortraitUrl);

        var creditScore = sessionStorage.getItem("creditScore");
        $("#creditScore").html(creditScore);
        userId = sessionStorage.getItem("userId");
        userState = sessionStorage.getItem("userState");
        if(userId==-1){
            alert(userId);
            $("#home").on("click",function(){
                $("#login").show().delay(2000).hide(300,function(){
                    window.location.href="../system/login.html";
                });
            });
            $("#pubOrder").on("click",function(){
                $("#login").show().delay(2000).hide(300,function(){
                    window.location.href="../system/login.html";
                });
            })
        }else{
            $("#home").on("click",function(){
                $("#banner").css("display","block");
                $("#left").css("display","block");
            })

            $("#left").on("click",function(){
                $("#banner").css("display","none");
                $("#left").css("display","none");
            })

            $("#pubOrder").on("click",function(){
                    window.location.href="pubOrder.html";

            })
        }
        if(userState==null){
            userState = 1;
        }

        /*   $.ajax({
         type: "post",
         url: '/randomdelivery/mobileHomePageController/homePage',
         data: {
         userId:userId
         },
         datatype: "json",
         success: function (data) {
         //alert(JSON.stringify(data));
         }

         });*/

        wantBuy();
    });

    function wantBuy(){
        for(var i=0;i<6;i++){
            $("#wantBuy").append('<li class="aui-list-item aui-list-item-middle">\
                <div class="aui-media-list-item-inner">\
                <div class="aui-list-item-media" style="width: 3rem;">\
                <img src="../../myImage/2.jpg" class="aui-img-round">\
                </div>\
                <div class="aui-list-item-inner">\
                <div class="aui-list-item-text">\
                <div class="aui-list-item-title aui-font-size-14">清风纸巾</div>\
                <div class="aui-list-item-right">买过4次</div>\
                </div>\
                <div class="aui-list-item-text">\
                <div class="aui-list-item-title aui-font-size-14"></div>\
                <div class="aui-list-item-right">物美超市</div>\
                </div>\
                </div>\
                </div>\
                </li>');
        }

    }



</script>

</body>
</html>